package com.thread.base01_thread;

import java.util.concurrent.*;

public class App6 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {

        ScheduledExecutorService executorService = Executors.newScheduledThreadPool(2);

        executorService.schedule(() -> {
            System.out.println(Thread.currentThread().getName() + ":线程启动");
        }, 3, TimeUnit.SECONDS);
        executorService.shutdown();

        executorService.scheduleAtFixedRate(
                ()-> System.out.println(Thread.currentThread().getName()),
                3,1, TimeUnit.SECONDS
        );
    }
}
